<%--
  Created by IntelliJ IDEA.
  User: 愿黑星照常升起
  Date: 2023/11/27
  Time: 9:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.edu.xaut.bean.Goods" %>
<%@ page import="java.util.ArrayList" %>
<html>
<head>
    <title>蛋糕商城</title>
    <link rel="stylesheet" href="./static/plugins/bootstrap-3.4.1-dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="./static/plugins/bootstrap-3.4.1-dist/js/bootstrap.js">

</head>
<body>
<jsp:include page="header.jsp"></jsp:include>



<%
    ArrayList<Goods> GoodsList = (ArrayList<Goods>) request.getAttribute("goodsList");
%>
<div class="container">
    <div class="goods">
        <%
            if (GoodsList == null ) {
                out.println("没有商品");
            } else {
                int i=0;
                for (Goods goods : GoodsList) {

        %>
        <% if (i%2==0) { %>
        <div class="row">
            <% }i++; %>
            <div class="col-md-3">
                <img src="./static/img/1.jpg" alt="" class="img-responsive">
            </div>
            <div class="col-md-3">
                <form name="OrderForm" action="userCartServlet" method="post" target="frameName">
                <input type="hidden" name="goodsid" value="<%= goods.getId()%>">
                <h3>商品1:<%= goods.getGoodsname()%></h3>
                <p>商品价格:<%= goods.getGoodsprice()%>￥</p>
                <button class="btn btn-primary" >加入购物车</button>
                </form>
                <iframe name="frameName" style="display: none" src="userCartServlet"></iframe>
            </div>
    <% if (i%2==0) { %>
        </div>
        <% } %>
        <%
                }
            }
        %>



    </div>
</div>
<jsp:include page="footer.jsp"></jsp:include>


</body>
</html>
